{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="A fully featured admin theme which can be used to build CRM, CMS, etc.">
    <meta name="author" content="Coderthemes">

    <link rel="shortcut icon" href="{% static '' %}velonic/img/favicon_1.ico">

    <title>我的店铺</title>

    <!-- DataTables -->
        <link href="{% static '' %}velonic/css/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
        <link href="{% static '' %}velonic/css/datatables/buttons.bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="{% static '' %}velonic/css/datatables/fixedHeader.bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="{% static '' %}velonic/css/datatables/responsive.bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="{% static '' %}velonic/css/datatables/scroller.bootstrap.min.css" rel="stylesheet" type="text/css" />


    <!-- Bootstrap core CSS -->
    <link href="{% static '' %}velonic/css/bootstrap.min.css" rel="stylesheet">
    <link href="{% static '' %}velonic/css/bootstrap-reset.css" rel="stylesheet">

    <!--Animation css-->
    <link href="{% static '' %}velonic/css/animate.css" rel="stylesheet">

    <!--Icon-fonts css-->
    <link href="{% static '' %}velonic/css/font-awesome.css" rel="stylesheet" />
    <link href="{% static '' %}velonic/css/ionicons.min.css" rel="stylesheet" />
    <link href="{% static '' %}velonic/css/material-design-iconic-font.min.css" rel="stylesheet" />

    <!--Morris Chart CSS -->
    <link rel="stylesheet" href="{% static '' %}velonic/css/morris.css">

    <!-- sweet alerts -->
    <link href="{% static '' %}velonic/css/sweet-alert.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="{% static '' %}velonic/css/style.css" rel="stylesheet">
    <link href="{% static '' %}velonic/css/helper.css" rel="stylesheet">



    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->


</head>


<body>

<!-- Aside Start-->
{% include 'velonic/block/side_nav.html' %}
<!-- Aside Ends-->


<!--Main Content Start -->
<section class="content">

<!-- Header -->
{% include 'velonic/block/header.html' %}
<!-- Header Ends -->


<!-- Page Content Start -->
<!-- ================== -->

<div class="wraper container-fluid">
<div class="page-title">
    <h3 class="title">我的店铺
    </h3>
</div>




<div class="row">
    <div class="col-lg-3 col-sm-6">
        <div class="tile-stats white-bg">
            <div class="status">
                <h3 class="m-t-0"><span class="counter">{{ storeList.count }}</span></h3>
                <p>个店铺</p>
            </div>
            <div class="chart-inline">
                <span class="inlinesparkline"></span>
            </div>
        </div>
    </div>

    <div class="col-lg-3 col-sm-6">
        <div class="tile-stats white-bg">
            <div class="status">
                <h3 class="m-t-0 counter">{{ products.count }}</h3>
                <p>款热销产品</p>
            </div>
            <span class="dynamicbar-big"></span>
        </div>
    </div>
</div>


<!-- WEATHER -->

    <div class="row">

                            <div class="col-md-12">
                                <div class="panel panel-default">
                                <div class="panel-heading"><h3 class="panel-title">店铺设置</h3></div>

                                <div class="panel-body">

                                <form class="form-inline p-20" role="form" action="" method="POST">
                                    {% csrf_token %}
                                    <div class="form-group">
                                        <label class="sr-only" for="storeIdInput">店铺ID</label>
                                        <input type="text" class="form-control" id="storeIdInput" name="storeId" placeholder="店铺ID">
                                    </div>

                                    <div class="form-group m-l-10">
                                        <label class="cr-styled">
                                            <input type="checkbox">
                                            <i class="fa"></i>
                                            优先采集
                                        </label>
                                    </div>
                                    <button type="submit" class="btn btn-success m-l-10">增加</button>
                                </form>
                            </div> <!-- panel-body -->

                                    <div class="panel-body">
                                        <div class="row">
                                            <div class="col-md-12 col-sm-12 col-xs-12">
                                                <table id="datatable" class="table table-striped table-bordered">
                                                    <thead>
                                                        <tr>
                                                            <th>店铺名</th>
                                                            <th>产品数</th>
                                                            <th>15天上架新品</th>
                                                            <th>15天出单新品</th>
                                                            <th>数据状态</th>
                                                            <th>＃操作</th>
                                                        </tr>
                                                    </thead>


                                                    <tbody class="sttable">
            {% for store in storeList %}
              <tr id="st-{{ store.id }}">
                <td><a href="{% url 'products' %}?store={{ store.store_id }}" target="_blank" >{{ store.seller }}</a></td>
                <td>{{ store.sale_items }}</td>
                <td>{{ store.new_arrivals_items }}</td>
                <td>{{ store.new_selling_items }}</td>
                <td>{{ store.status }} </td>
                <td><a href="{% url 'monitorStoreNew' %}?st={{ store.store_id }}" class="btn btn-info btn-xs">查看热卖新品</a> <button type="button" class="btn btn-danger btn-xs" onclick="removestore('{{ store.id }}')">删除</button></td>
              </tr>
            {% endfor %}
            </tbody>
                                                </table>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div> <!-- End Row -->


</div>
<!-- Page Content Ends -->
<!-- ================== -->

<!-- Footer Start -->
{% include 'velonic/block/footer.html' %}
<!-- Footer Ends -->



</section>
<!-- Main Content Ends -->








<!-- js placed at the end of the document so the pages load faster -->
<script src="{% static '' %}velonic/js/jquery.js"></script>
<script src="{% static '' %}velonic/js/bootstrap.min.js"></script>
<script src="{% static '' %}velonic/js/modernizr.min.js"></script>
<script src="{% static '' %}velonic/js/pace.min.js"></script>
<script src="{% static '' %}velonic/js/wow.min.js"></script>
<script src="{% static '' %}velonic/js/jquery.scrollTo.min.js"></script>
<script src="{% static '' %}velonic/js/jquery.nicescroll.js" type="text/javascript"></script>

<!-- Counter-up -->
<script src="{% static '' %}velonic/js/waypoints.min.js" type="text/javascript"></script>
<script src="{% static '' %}velonic/js/jquery.counterup.min.js" type="text/javascript"></script>

<!-- sparkline -->
<script src="{% static '' %}velonic/js/jquery.sparkline.min.js" type="text/javascript"></script>
<script src="{% static '' %}velonic/js/chart-sparkline.js" type="text/javascript"></script>

<!-- skycons -->
<script src="{% static '' %}velonic/js/skycons.min.js" type="text/javascript"></script>

<!--Morris Chart-->
 <script src="{% static '' %}velonic/js/sweet-alert.min.js"></script>


<script src="{% static '' %}velonic/js/jquery.app.js"></script>

<!-- Dashboard -->

<!-- Datatables-->
        <script src="{% static '' %}velonic/js/datatables/jquery.dataTables.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/dataTables.bootstrap.js"></script>
        <script src="{% static '' %}velonic/js/datatables/dataTables.buttons.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/buttons.bootstrap.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/jszip.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/pdfmake.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/vfs_fonts.js"></script>
        <script src="{% static '' %}velonic/js/datatables/buttons.html5.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/buttons.print.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/dataTables.fixedHeader.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/dataTables.keyTable.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/dataTables.responsive.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/responsive.bootstrap.min.js"></script>
        <script src="{% static '' %}velonic/js/datatables/dataTables.scroller.min.js"></script>

<!-- Datatable init js -->
        <script src="{% static '' %}velonic/js/datatables.init.js"></script>


<script type="text/javascript">
    jQuery(document).ready(function($) {
        /* Counter Up */
        $('.counter').counterUp({
            delay: 100,
            time: 1200
        });
    });
    /* BEGIN SVG WEATHER ICON */
    if (typeof Skycons !== 'undefined'){
        var icons = new Skycons(
                        {"color": "#fff"},
                        {"resizeClear": true}
                ),
                list  = [
                    "clear-day", "clear-night", "partly-cloudy-day",
                    "partly-cloudy-night", "cloudy", "rain", "sleet", "snow", "wind",
                    "fog"
                ],
                i;

        for(i = list.length; i--; )
            icons.set(list[i], list[i]);
        icons.play();
    };
</script>

<script type="text/javascript">

            var dtTranslate={//下面是一些汉语翻译
                "sSearch": "搜索",
                "sLengthMenu": "每页显示 _MENU_",
                "sZeroRecords": "没有检索到数据",
                "sInfo": "显示 _START_ 至 _END_ 条 &nbsp;&nbsp;共 _TOTAL_ 条 &nbsp;&nbsp;",
                "sInfoFiltered": "(筛选自 _MAX_ 条数据)",
                "sInfoEmtpy": "没有数据",
                "sProcessing": "<img src='/public/images/loading.gif' /> 数据加载中...",
                "oPaginate":
                            {
                                "sFirst": "首页",
                                "sPrevious": "前一页",
                                "sNext": "后一页",
                                "sLast": "末页"
                            }
            }


            $(document).ready(function() {
                $('#datatable').dataTable({"oLanguage": dtTranslate});
                $('#datatable-responsive').DataTable({"oLanguage": dtTranslate});
                $('#datatable-buttons').DataTable();
                $('#table-evaluate').DataTable({"oLanguage": dtTranslate});
                var table = $('#datatable-fixed-header').DataTable( { fixedHeader: true,"oLanguage": dtTranslate } );
            } );
            TableManageButtons.init();





        </script>

<script>
    function removestore(id){
          swal({
            title: "你确定移除此店铺吗?",
            text: "此店铺将从列表移除!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "是, 删除 !",
            cancelButtonText: "否, 取消 !",
            closeOnConfirm: false,
            closeOnCancel: false
        }, function(isConfirm){
            if (isConfirm) {
                $.get("{% url 'remove_store' %}?id="+id, function(result){
                if(result=='1'){
                    $('#st-'+id).remove();
                    swal({
                        title: "操作成功!",
                        text: "成功移除店铺［"+id+"］!",
                        timer: 1000,
                        showConfirmButton: false
                    });
                }else{
                    swal("移除失败", "error");
                }
              });
            }else {
                swal("已取消", "取消操作", "error");
            }
        });
      }
</script>


{% include 'velonic/block/footer_comm.html' %}


</body>
</html>
